<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>登陆聊天室</title>
    <link rel="stylesheet" href="css/index.css">
  </head>
  <body>
    <form>
    <div class="model">

        <header class="bg-blue">计科三班专属聊天室</header>
        <div class="login-body">
          <div>
            <label for="username">账号</label>
            <input class="username" type="text" name="username" required="true">
          </div>
          <div>
            <label for="password">密码</label>
            <input class="password" type="password" name="password" required="true">
          </div>
          <div>
            <input id="loginBtn" type="button" value="登陆">
            <input type="reset" value="重置">
          </div>
        </div>

    <div>
      </form>
  </body>
</html>
<script src="js/jquery-2.0.3.min.js"></script>
<script>
  $("#loginBtn").click(function(){
    var data = $(".username").val();
    if (data != "" && $(".password").val()!="") {
      sessionStorage.username = data;
      location.href = "/";
    }
  });
  document.onkeydown = function(e){
    var ev = document.all ? window.event : e;
    if(ev.keyCode==13) {
      $("#loginBtn").click();
     }
  }
</script>
